package net.hn.hnms.biz.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.hn.hnms.biz.project.domain.LegalPerson;
import net.hn.hnms.biz.project.domain.StandingBookFile;
import net.hn.hnms.biz.project.vo.ProjectInfoVo;
import net.hn.hnms.biz.project.vo.SupplierInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StandingFileMapper extends BaseMapper<StandingBookFile> {

    @Update("<script>" +
            " update  standing_book_file set  del_flag = '1' " +
            " where standing_id = #{projectId}" +
            "</script>")
    void updateDeleteById(@Param("projectId")String projectId);

    @Select("<script>" +
            " select project_file_id projectFileId,project_file_name projectFileName,project_file_path projectFilePath," +
            "create_user_id createUserId,create_time createTime,standing_id projectId,oss_id ossId from standing_book_file" +
            " where del_flag = '0' and standing_id = #{projectId}" +
            "</script>")
    List<StandingBookFile> selectFileById(@Param("projectId")String projectId);

    @Select("<script>" +
            " select standing_id projectId,project_code projectCode,project_name projectName" +
            " from project_info " +
            " where del_flag = '0' " +
            "</script>")
    List<ProjectInfoVo> getProjectList();

    @Select("<script>" +
            " select supplier_id supplierId,supplier_code supplierCode,supplier_name supplierName,legal_person_name legalPersonName" +
            " from supplier_info " +
            " where del_flag = '0' " +
            "</script>")
    List<SupplierInfoVo> getSupplierInfo();

    @Select("<script>" +
            " select legal_person_id legalPersonId,legal_person_code legalPersonCode,legal_person_name legalPersonName,company" +
            " from legal_person " +
            " where del_flag = '0' " +
            "</script>")
    List<LegalPerson> getLegalPerson();



}
